package com.qf.smsplatform.monitor.config;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.connection.Connection;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ChannelConfig {

    @Bean
    public Channel rabbitMQChannel(ConnectionFactory factory){
        //1. 获取连接对象
        Connection connection = factory.createConnection();
        //2. 创建Channel
        Channel channel = connection.createChannel(false);
        //3. 返回
        return channel;
    }

}
